package com.kaishengit.action;

import hirondelle.date4j.DateTime;

import java.util.List;

import com.kaishengit.pojo.TaskType;
import com.kaishengit.service.TaskTypeService;
import com.kaishengit.util.DateUtil;
import com.kaishengit.util.PKUtil;
import com.kaishengit.util.Rand;

public class TaskTypeAction {
	private TaskTypeService taskTypeService;
	private List<TaskType> liTypes;
	private String  type;
	private String typeid;
	private String typeColor;
 public String execute(){
	 
	 liTypes=taskTypeService.findall();
	 
	 for(TaskType t:liTypes){
		/* DateTime dateAndTime = new DateTime(t.getCreatetime());
		 String createtimes=dateAndTime.format("mm:ss");*/
		 t.setDealuuid(PKUtil.getPk());
	
		 t.setCreatetimes(PKUtil.getPk());
		
	 }
	 return "success";
 }
 public String dealTaskType(){
	 TaskType t=taskTypeService.findByTypeid(typeid);
	 t.setEnable(false);
	 taskTypeService.save(t);
	 return null;
 }
 public String updateType(){
 /* =new TaskType();*/
  TaskType t=  taskTypeService.findByTypeid(typeid);
      t.setColor(typeColor);
      t.setType(type);
     
/*	 t.setId(typeid);
	 t.setColor(typeColor);
	 t.setCreatetime(DateUtil.getNow());
	 t.setUuids(PKUtil.getPk());*/
	 taskTypeService.save(t);
	 return null;
 }
 
public String addType(){
	TaskType t=new TaskType();
	t.setType(type);
	t.setColor(Rand.getRandom());
	t.setUuids(PKUtil.getPk());
	t.setCreatetime(DateUtil.getNow());
	t.setEnable(true);
   taskTypeService.save(t);
	return "success";
	
}
 
public String getTypeColor() {
	return typeColor;
}

public void setTypeColor(String typeColor) {
	this.typeColor = typeColor;
}

public String getTypeid() {
	return typeid;
}
public void setTypeid(String typeid) {
	this.typeid = typeid;
}
public TaskTypeService getTaskTypeService() {
	return taskTypeService;
}

public void setTaskTypeService(TaskTypeService taskTypeService) {
	this.taskTypeService = taskTypeService;
}

public List<TaskType> getLiTypes() {
	return liTypes;
}

public void setLiTypes(List<TaskType> liTypes) {
	this.liTypes = liTypes;
}

public String getType() {
	return type;
}

public void setType(String type) {
	this.type = type;
}
 
 
 
 
 
}
